package com.gxa.eurekaclient.controller;

import com.gxa.eurekaclient.service.YongHuService;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author thinknovo
 * @version 1.0
 * @description MyController.java
 * @date 2021/3/9 11:26
 */
@RestController
@RequestMapping(value = "user", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class MyController {
    @Resource
    private YongHuService yongHuService;

    @RequestMapping(value = "/login")
    public Map<String, Object> login(String username) {
        System.out.println("username=" + username);
        Map<String, Object> map = new HashMap<>();
        map.put("code", 200);
        map.put("msg", "8863登录成功!");
        map.put("username", username);
        return map;
    }

    @RequestMapping(value = "/selectAll", method = RequestMethod.GET)
    public Map<String, Object> selectAll(String yongHuMingCheng) {
        System.out.println("client selectAll方法被调用");
        return yongHuService.selectAll(yongHuMingCheng);
    }
}
